package br.com.merks.controller.component;

import org.apache.log4j.Logger;

import br.com.caelum.vraptor.ioc.Component;
import br.com.caelum.vraptor.ioc.SessionScoped;
import br.com.merks.model.User;
@Component
@SessionScoped
public class UserSessionHandler {
	public static final Logger logger = Logger.getLogger(UserSessionHandler.class);
	  private User user;
	  
	  public void setUser(User objeto) {
	    	if (logger.isDebugEnabled()) { 
		    		if (objeto !=null ) {
		    			logger.debug("Setting user: " + objeto.getEmail());
			    	} else {
			    		logger.debug("Dropping actual user.");
			    	}
	    		}
	    	this.user = objeto;
	      
	     }
	     public User getUser() {
	    	 if (logger.isDebugEnabled()) {
	    		 if (user!=null)
	    			 logger.debug("Retrieving user object: " + user.getEmail());
	    	 }
	         return user;
	     }
}
